#include <cstdlib>
#include <string.h>
#include <iostream>
#include <fstream>
#include <sstream>
#include <vector>
#include <string>

using namespace std;

class Singleton{
public:
    
    static Singleton* getIntance(){
        if(_s==nullptr){
            _s=new Singleton();
            atexit(destroy);
        }
        return _s;
    }

private:
    Singleton(){}
    Singleton(const Singleton&)=delete;
    Singleton& operator=(const Singleton&)=delete;

    static void destroy(){
        if(_s){
            delete _s;
            _s=nullptr;
        }
    }
    
    ~Singleton(){}

    static Singleton* _s;
};
Singleton* Singleton::_s;

void test(){
    Singleton::getIntance();
}

int main()
{
 test();
 return 0;
}

